<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Show</title>
<style>
#header {
	background-color:black;
	color:white;
	text-align:center;
    padding:1px;}
#footon {
	background-color:white;
	color:black;
	text-align:center;
    padding:5px;
	clear:both;
}
#foot {
	background-color:black;
	color:white;
	text-align:center;
    padding:20px;
	clear:both;
}
.city {
	background-color:yellow;
    float: left;
    margin: 5px;
    padding: 15px;
    width: 270px;
    height: 200px;
    border: 2px solid black;
	text-align:center;
} 
</style>
</head>
 
<body>
<div id="header">
    <h1>文章展示</h1><br><b><a href="../html/select.html">点击进入->文章搜索</a></b>
</div>
<br>
<?php
session_start();
include_once("../class/mysqlclass.php");
header('Content-type:text/html;charset=UTF-8');
$_SESSION['act']='guanli';
$mysqli = new writing;
$mysqli = $mysqli -> Con();
$sql = "select * from `write` ";
$res=$mysqli->query($sql);
$wzs=0;
$getid=$_GET['id'];
$id= 0;
foreach($res as $var){
	$id=$id + 1;
	$wzs++;
	if($id>($getid-1)*4){
		echo '<div class="city">';
		echo '<p>第'.$id.'篇<br>标题：'.$var['title'].'<br>作者：'.$var['author'].'<br>时间：'.$var['time'];
    	echo '<hr/><a href="./skim.php?id='.$var['id'].'&page=1">查看</a>';
    	if($var['author']==$_SESSION['ath']){ 
			echo '|<a href="./modify.php?id='.$var['id'].'">修改</a>|<a href="./deleteone.php?id=wz'.$var['id'].'">删除</a></p>';
		}
		echo '</div>';
	}
    if($id==$getid*4){
		break;
	}
}
for(;$id<$getid*4;$id++){
	echo '<div class="city"><p style="color:red">该区域空空如也</p></div>';
}
//分页
echo '<div id="footon"><hr/><p>页码：';
if($wzs%4!=0){
	$yema=($wzs-$wzs%4)/4+1;
}
else{
	$yema= $wzs/4;
}
for($i=1;$i<=$yema;$i++){
	echo '<a href="show.php?id='.$i.'">'.$i.'</a>';
	echo ' ';
}
echo '</p></div>';
?>
<div id="foot">
    <h2><a href="../html/article.html">返回文章管理</a></h2>
</div>
</body>
</html>